//
//  MineHeadView.m
//  Village
//
//  Created by longrise on 2017/9/7.
//  Copyright © 2017年 程虎. All rights reserved.
//

#import "MineHeadView.h"
@interface MineHeadView ()
@end
@implementation MineHeadView
- (instancetype)initWithFrame:(CGRect)frame{
    
    self=[super initWithFrame:frame];
    if (self) {
    }
    _headImageView = [[UIImageView alloc] init];
    _headImageView.backgroundColor = [UIColor redColor];
    [self addSubview:_headImageView];
    [_headImageView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.mas_left).offset(0);//使左边等于self.view的左边，间距为0
        make.top.equalTo(self.mas_top).offset(0.5);//使顶部与self.ScrollWebView的底部间距为0
        make.right.equalTo(self.mas_right).offset(0);
        make.height.mas_equalTo(134);
    }];
    
    _portraitImageView = [[UIImageView alloc] init];
    _portraitImageView.image = [UIImage imageNamed:@"position"];
    _portraitImageView.layer.cornerRadius=35.0f;// 将图层的边框设置为圆角
    _portraitImageView.layer.masksToBounds=YES;// 隐藏边界
    [_headImageView addSubview:_portraitImageView];
    [_portraitImageView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.mas_left).offset(23);//使左边等于self.view的左边，间距为0
        make.top.equalTo(self.mas_top).offset(46);//使顶部与self.ScrollWebView的底部间距为0
        make.height.mas_equalTo(70);
        make.width.mas_equalTo(70);
    }];
    
    _loginlable = [[UILabel alloc] init];
    _loginlable.text = @"请先登录";
    _loginlable.textColor = [UIColor whiteColor];
    _loginlable.font = [UIFont systemFontOfSize:18];
    [self addSubview:_loginlable];
    [_loginlable mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(_portraitImageView.mas_right).offset(20);//使左边等于self.view的左边，间距为0
        make.top.equalTo(self.mas_top).offset(kNavHeight);//使顶部与self.ScrollWebView的底部间距为0
        make.height.mas_equalTo(30);
        make.width.mas_equalTo(170);
    }];
    
    _namelable = [[UILabel alloc] init];
    _namelable.font = [UIFont systemFontOfSize:20];
    _namelable.textColor = [UIColor whiteColor];
    _namelable.text = @"肖庆林";
    [_headImageView addSubview:_namelable];
    [_namelable mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(_portraitImageView.mas_right).offset(20);//使左边等于self.view的左边，间距为0
        make.top.equalTo(self.mas_top).offset(54);//使顶部与self.ScrollWebView的底部间距为0
        make.height.mas_equalTo(30);
        make.width.mas_equalTo(170);
    }];
    
    _medalImageView = [[UIImageView alloc] init];
    _medalImageView.image = [UIImage imageNamed:@"position"];
    [_headImageView addSubview:_medalImageView];
    [_medalImageView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(_namelable.mas_left).offset(0);//使左边等于self.view的左边，间距为0
        make.top.equalTo(_namelable.mas_bottom).offset(13);//使顶部与self.ScrollWebView的底部间距为0
        make.height.mas_equalTo(17);
        make.width.mas_equalTo(14);
    }];
    
    _introducelable = [[UILabel alloc] init];
    _introducelable.font = [UIFont systemFontOfSize:15];
    _introducelable.textColor = [UIColor whiteColor];
    _introducelable.text = @"金融港村委员会·财务委员";
    [_headImageView addSubview:_introducelable];
    [_introducelable mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(_medalImageView.mas_right).offset(3);//使左边等于self.view的左边，间距为0
        make.top.equalTo(_namelable.mas_bottom).offset(14);//使顶部与self.ScrollWebView的底部间距为0
        make.height.mas_equalTo(15);
        make.width.mas_equalTo(250);
    }];

    _setButton= [[UIButton alloc] init];
    [self addSubview:_setButton];
    [_setButton mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.equalTo(self.mas_right).offset(-17);//使左边等于self.view的左边，间距为0
        make.top.equalTo(self.mas_top).offset(43);//使顶部与self.ScrollWebView的底部间距为0
        make.height.mas_equalTo(30);
        make.width.mas_equalTo(30);
    }];
    {
        return self;
    }
}

/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/

@end
